<%@ page language="java" pageEncoding="UTF-8"%>
<%@page import="com.shsh.safemanage.util.Util"%>
<%@page import="com.shsh.safemanage.util.Constants"%>
<%@page import="com.shsh.safemanage.action.ActionCreator"%>
<%@page import="com.shsh.safemanage.action.BrowseProblemAction"%>
<%@page import="com.shsh.safemanage.model.Problem"%>
<%@page import="java.util.List"%>
<%@page import="com.shsh.safemanage.dao.DaoCreator"%>
<%@page import="com.shsh.safemanage.dao.ProblemDao"%>
<%@page import="com.shsh.safemanage.util.RequestUtil"%>

<%
{
int pageNum = RequestUtil.getParameter(request, Constants.REQUEST_PARAMETER_PAGE_NUM, 1);
BrowseProblemAction browseAction = ActionCreator.createBrowseProblemAction();
List<Problem> problemList = browseAction.browseProblems(request);
int totalNum = (Integer) request.getAttribute(Constants.DAO_RESULT_NUMBER);
Integer totalPage = 0;
if (totalNum % Constants.PAGE_SIZE == 0) {
	totalPage = totalNum / Constants.PAGE_SIZE;
} else {
	totalPage = totalNum / Constants.PAGE_SIZE + 1;
}
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="font-size:12px;">
	<tr>
		<td width="8"  class="appbg">&nbsp;</td>
		<td width="85" class="appbg"><img src="../images/trace.gif"  style="vertical-align:middle;"/>查询结果</td>
		<td width="229" class="appbg">&nbsp;</td>
		<td width="58" class="appbg">&nbsp;</td>
		<td width="84" class="appbg">&nbsp;</td>
		<td width="74" class="appbg">&nbsp;</td>
		<td colspan="2" class="appbg">&nbsp;</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td colspan="6" height="40">查询到<font color="#FF0000"><%=totalNum%></font>条记录，共<font color="#FF0000"><%=totalPage%></font>页。</td>
		<td><input type="button" id="btnDelete" name="删除问题" value="删除问题" onclick="deleteProblem();"/></td>
		<td></td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td class="td1" height="35" colspan="8">
		<%=pageNum==1?"上一页":"<a href=\"javascript:\" onclick=\"browseOverallProblems("+(pageNum-1)+")\">上一页</a>" %>
			<%=pageNum %>
		<%=problemList.size()<Constants.PAGE_SIZE?"下一页":"<a href=\"javascript:\" onclick=\"browseOverallProblems("+(pageNum+1)+")\">下一页</a>" %>
		</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td width="10%" class="a_text2" align="center">选择</td>
		<td class="a_text2" width="20%" height="30">作业部（业务中心）</td>
		<td class="a_text2" width="20%">装置</td>
		<td width="20%" class="a_text2">问题标题</td>
		<td width="6%" class="a_text2" align="center">发现人</td>
		<td width="12%" class="a_text2" align="center">填报日期</td>
		<td width="12%" class="a_text2" align="center">回复日期</td>
		<td width="17"></td>
	</tr>
	<%
	for (Problem problem : problemList) {
	%>
	<tr>
		<td>&nbsp;</td>
		<td align="center" class="a_text3" style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; background: #F9F9F9">
			<input type="checkbox" id="<%=problem.getId()%>" name="problemChecker" value="<%=problem.getId()%>"/>
		</td>
		<td class="a_text3" style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; background: #F9F9F9">
			<%=problem.getDepartment1Name()%></td>
		<td class="a_text3" style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; background: #F9F9F9">
			<%=Util.getDisplay(problem.getEquipmentName(), "&nbsp;")%></td>
		<td class="a_text3" style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; background: #F9F9F9">
			<%=problem.getProblemTitle()%></td>
		<td align="center" class="a_text3" style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; background: #F9F9F9">
			<%=problem.getWriteUserName()%></td>
		<td align="center" class="a_text3" style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; background: #F9F9F9">
			<%=Util.formatDate(problem.getWriteTime().getTime())%></td>
		<td align="center" class="a_text3" style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; background: #F9F9F9">
			<%=(problem.getCloseTime() == null)? "&nbsp;" : Util.formatDate(problem.getCloseTime().getTime())%></td>		
		<td width="17"></td>
	</tr>
	<%
	}
	%>
	<tr>
		<td>&nbsp;</td>
		<td class="td1" height="35" colspan="8">
		<%=pageNum==1?"上一页":"<a href=\"javascript:\" onclick=\"browseOverallProblems("+(pageNum-1)+")\">上一页</a>" %>
			<%=pageNum %>
		<%=problemList.size()<Constants.PAGE_SIZE?"下一页":"<a href=\"javascript:\" onclick=\"browseOverallProblems("+(pageNum+1)+")\">下一页</a>" %>
		</td>
	</tr>
</table>
<%
}
%>